package cn.zymall.app.service.impl;

import cn.zymall.app.mapper.HomeBillboardsMapper;
import cn.zymall.app.service.HomeBillboardsService;
import cn.zymall.common.model.HomeBillboards;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: mall
 * @description: 广告业务实现类
 * @author: YueNiao
 * @email: 1486617253@qq.com
 * @create: 2020-08-20 11:32
 **/
@Service
public class HomeBillboardsServiceImpl extends ServiceImpl<HomeBillboardsMapper, HomeBillboards> implements HomeBillboardsService {
	@Autowired
	private HomeBillboardsMapper homeBillboardsMapper;

	/**
	 * 分页全部查询
	 * @param page
	 * @param rows
	 * @return
	 */
	@Override
	public PageInfo<HomeBillboards> findAll(@Param("page") int page, @Param("rows") int rows) {
		PageHelper.startPage(page,rows);
		List<HomeBillboards> list=homeBillboardsMapper.findAll();
		PageInfo<HomeBillboards> pageaa = new PageInfo<>(list);
		return pageaa;
	}

	/**
	 * 模糊查询
	 * @param value
	 * @param page
	 * @param rows
	 * @return
	 */
	@Override
	public PageInfo<HomeBillboards> moFindAll(String value, int page, int rows) {
		PageHelper.startPage(page,rows);
		List<HomeBillboards> list=homeBillboardsMapper.moFindAll(value);
		PageInfo<HomeBillboards> pageaa = new PageInfo<>(list);
		return pageaa;
	}
}
